package com.shqcjd.yunweiyanoperator;

import android.content.Context;
import android.content.Intent;
import android.os.Handler;

import com.shqcjd.yunweiyanoperator.ui.activity.LoginActivity;
import com.shqcjd.yunweiyanoperator.ui.activity.staff.MainActivity;
import com.shqcjd.yunweiyanoperator.ui.base.BaseActivity;
import com.shqcjd.yunweiyanoperator.ui.base.BasePresenter;
import com.shqcjd.yunweiyanoperator.util.PrefUtils;

public class SplashActivity extends BaseActivity {

    private Context mContext;

    @Override
    protected boolean isFullScreen() {
        return true;
    }

    @Override
    protected BasePresenter createPresenter() {
        return null;
    }

    @Override
    protected int provideContentViewId() {
        return R.layout.activity_splash;
    }

    @Override
    public void initView() {
        super.initView();
        mContext = this;
        goIndex();

    }

    private void goIndex(){
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
//                //延迟两秒钟执行
                Boolean firstLogin =  PrefUtils.getBoolean(mContext, PrefUtils.FIRST_LOGIN, false);
                if (firstLogin) {
                    startActivity(new Intent(mContext, MainActivity.class));
                } else {
                    startActivity(new Intent(mContext, LoginActivity.class));
                }

                finish();
            }
        }, 2000);
    }
}
